const Controller = require('egg').Controller;

class userController extends Controller{
    async create(){
      this.ctx.body =[
        {
          name:'用户1',
          status:'已激活',
          number:'1000'
          
      },
      {
       name:'用户2',
       status:'未激活',
       number:'0'
   }


      ]


     
  
   
    }
    async a(){
       this.ctx.body  = [
       {
         title:'发票a',
         placeholder:'请输入发票a'
       },
       {
        title:'发票b',
        placeholder:'请输入发票b'
      }


       ]
      


    }
    async getT(){

      let a = await this.ctx.request.body;



      exports.mysql = {
        // 单数据库信息配置
        client: {
          // host
          host: '120.53.107.58',
          // 端口号
          port: '3306',
          // 用户名
          user: 'student',
          // 密码
          password: '00000000',
          // 数据库名
          database: 'student',
        },
        // 是否加载到 app 上，默认开启
        app: true,
        // 是否加载到 agent 上，默认关闭
        agent: false,
      };

    let result = await this.app.mysql.get("user",{id:1})

    console.log(result);

      //接到发票数据
      console.log(a);
      var name = a.name;
      var number = a.number;

      var arr = [];




      arr.push({title:name,number:number});

      this.ctx.body = arr;






    }
   
    
    
}

module.exports = userController;
